Optimal. Leaf size=204 \[ -\frac {2 \left (a A b-2 a^2 B+b^2 B\right ) \sqrt {a+b \cos (c+d x)} E\left (\frac {1}{2} (c+d x)|\frac {2 b}{a+b}\right )}{b^2 \left (a^2-b^2\right ) d \sqrt {\frac {a+b \cos (c+d x)}{a+b}}}+\frac {2 (A b-2 a B) \sqrt {\frac {a+b \cos (c+d x)}{a+b}} F\left (\frac {1}{2} (c+d x)|\frac {2 b}{a+b}\right )}{b^2 d \sqrt {a+b \cos (c+d x)}}+\frac {2 a (A b-a B) \sin (c+d x)}{b \left (a^2-b^2\right ) d \sqrt {a+b \cos (c+d x)}} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.22, antiderivative size = 204, normalized size of antiderivative = 1.00, number of steps
used = 7, number of rules used = 7, integrand size = 31, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.226, Rules used = {3047, 3100,
2831, 2742, 2740, 2734, 2732} \begin {gather*} \frac {2 a (A b-a B) \sin (c+d x)}{b d \left (a^2-b^2\right ) \sqrt {a+b \cos (c+d x)}}-\frac {2 \left (-2 a^2 B+a A b+b^2 B\right ) \sqrt {a+b \cos (c+d x)} E\left (\frac {1}{2} (c+d x)|\frac {2 b}{a+b}\right )}{b^2 d \left (a^2-b^2\right ) \sqrt {\frac {a+b \cos (c+d x)}{a+b}}}+\frac {2 (A b-2 a B) \sqrt {\frac {a+b \cos (c+d x)}{a+b}} F\left (\frac {1}{2} (c+d x)|\frac {2 b}{a+b}\right )}{b^2 d \sqrt {a+b \cos (c+d x)}} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 2732
Rule 2734
Rule 2740
Rule 2742
Rule 2831
Rule 3047
Rule 3100
Rubi steps
\begin {align*} \int \frac {\cos (c+d x) (A+B \cos (c+d x))}{(a+b \cos (c+d x))^{3/2}} \, dx &=\int \frac {A \cos (c+d x)+B \cos ^2(c+d x)}{(a+b \cos (c+d x))^{3/2}} \, dx\\ &=\frac {2 a (A b-a B) \sin (c+d x)}{b \left (a^2-b^2\right ) d \sqrt {a+b \cos (c+d x)}}-\frac {2 \int \frac {\frac {1}{2} b (A b-a B)+\frac {1}{2} \left (a A b-2 a^2 B+b^2 B\right ) \cos (c+d x)}{\sqrt {a+b \cos (c+d x)}} \, dx}{b \left (a^2-b^2\right )}\\ &=\frac {2 a (A b-a B) \sin (c+d x)}{b \left (a^2-b^2\right ) d \sqrt {a+b \cos (c+d x)}}+\frac {(A b-2 a B) \int \frac {1}{\sqrt {a+b \cos (c+d x)}} \, dx}{b^2}-\frac {\left (a A b-2 a^2 B+b^2 B\right ) \int \sqrt {a+b \cos (c+d x)} \, dx}{b^2 \left (a^2-b^2\right )}\\ &=\frac {2 a (A b-a B) \sin (c+d x)}{b \left (a^2-b^2\right ) d \sqrt {a+b \cos (c+d x)}}-\frac {\left (\left (a A b-2 a^2 B+b^2 B\right ) \sqrt {a+b \cos (c+d x)}\right ) \int \sqrt {\frac {a}{a+b}+\frac {b \cos (c+d x)}{a+b}} \, dx}{b^2 \left (a^2-b^2\right ) \sqrt {\frac {a+b \cos (c+d x)}{a+b}}}+\frac {\left ((A b-2 a B) \sqrt {\frac {a+b \cos (c+d x)}{a+b}}\right ) \int \frac {1}{\sqrt {\frac {a}{a+b}+\frac {b \cos (c+d x)}{a+b}}} \, dx}{b^2 \sqrt {a+b \cos (c+d x)}}\\ &=-\frac {2 \left (a A b-2 a^2 B+b^2 B\right ) \sqrt {a+b \cos (c+d x)} E\left (\frac {1}{2} (c+d x)|\frac {2 b}{a+b}\right )}{b^2 \left (a^2-b^2\right ) d \sqrt {\frac {a+b \cos (c+d x)}{a+b}}}+\frac {2 (A b-2 a B) \sqrt {\frac {a+b \cos (c+d x)}{a+b}} F\left (\frac {1}{2} (c+d x)|\frac {2 b}{a+b}\right )}{b^2 d \sqrt {a+b \cos (c+d x)}}+\frac {2 a (A b-a B) \sin (c+d x)}{b \left (a^2-b^2\right ) d \sqrt {a+b \cos (c+d x)}}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A]
time = 0.88, size = 170, normalized size = 0.83 \begin {gather*} -\frac {2 \left (-\left ((a+b) \left (-a A b+2 a^2 B-b^2 B\right ) \sqrt {\frac {a+b \cos (c+d x)}{a+b}} E\left (\frac {1}{2} (c+d x)|\frac {2 b}{a+b}\right )\right )+\left (a^2-b^2\right ) (-A b+2 a B) \sqrt {\frac {a+b \cos (c+d x)}{a+b}} F\left (\frac {1}{2} (c+d x)|\frac {2 b}{a+b}\right )+a b (-A b+a B) \sin (c+d x)\right )}{(a-b) b^2 (a+b) d \sqrt {a+b \cos (c+d x)}} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [B] Leaf count of result is larger than twice the leaf count of optimal. \(518\) vs.
\(2(252)=504\).
time = 0.46, size = 519, normalized size = 2.54
method | result | size |
default | \(-\frac {\sqrt {-\left (-2 \left (\cos ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right ) b -a +b \right ) \left (\sin ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}\, \left (\frac {2 \sqrt {\frac {1}{2}-\frac {\cos \left (d x +c \right )}{2}}\, \sqrt {-\frac {2 b \left (\sin ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{a -b}+\frac {a +b}{a -b}}\, \left (A b \EllipticF \left (\cos \left (\frac {d x}{2}+\frac {c}{2}\right ), \sqrt {-\frac {2 b}{a -b}}\right )-2 B \EllipticF \left (\cos \left (\frac {d x}{2}+\frac {c}{2}\right ), \sqrt {-\frac {2 b}{a -b}}\right ) a +B \EllipticE \left (\cos \left (\frac {d x}{2}+\frac {c}{2}\right ), \sqrt {-\frac {2 b}{a -b}}\right ) a -B \EllipticE \left (\cos \left (\frac {d x}{2}+\frac {c}{2}\right ), \sqrt {-\frac {2 b}{a -b}}\right ) b \right )}{b^{2} \sqrt {-2 \left (\sin ^{4}\left (\frac {d x}{2}+\frac {c}{2}\right )\right ) b +\left (a +b \right ) \left (\sin ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}}+\frac {2 a \left (A b -a B \right ) \sqrt {-2 \left (\sin ^{4}\left (\frac {d x}{2}+\frac {c}{2}\right )\right ) b +\left (a +b \right ) \left (\sin ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}\, \left (2 b \left (\sin ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right ) \cos \left (\frac {d x}{2}+\frac {c}{2}\right )+\sqrt {-\frac {2 b \left (\sin ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{a -b}+\frac {a +b}{a -b}}\, \sqrt {\frac {1}{2}-\frac {\cos \left (d x +c \right )}{2}}\, \EllipticE \left (\cos \left (\frac {d x}{2}+\frac {c}{2}\right ), \sqrt {-\frac {2 b}{a -b}}\right ) a -\sqrt {-\frac {2 b \left (\sin ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{a -b}+\frac {a +b}{a -b}}\, \sqrt {\frac {1}{2}-\frac {\cos \left (d x +c \right )}{2}}\, \EllipticE \left (\cos \left (\frac {d x}{2}+\frac {c}{2}\right ), \sqrt {-\frac {2 b}{a -b}}\right ) b \right )}{b^{2} \sin \left (\frac {d x}{2}+\frac {c}{2}\right )^{2} \left (2 \left (\sin ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right ) b -a -b \right ) \left (a^{2}-b^{2}\right )}\right )}{\sin \left (\frac {d x}{2}+\frac {c}{2}\right ) \sqrt {-2 \left (\sin ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right ) b +a +b}\, d}\) | \(519\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Failed to integrate} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [C] Result contains higher order function than in optimal. Order 9 vs. order
4.
time = 0.17, size = 683, normalized size = 3.35 \begin {gather*} -\frac {6 \, {\left (B a^{2} b^{2} - A a b^{3}\right )} \sqrt {b \cos \left (d x + c\right ) + a} \sin \left (d x + c\right ) + {\left (\sqrt {2} {\left (-4 i \, B a^{3} b + 2 i \, A a^{2} b^{2} + 5 i \, B a b^{3} - 3 i \, A b^{4}\right )} \cos \left (d x + c\right ) + \sqrt {2} {\left (-4 i \, B a^{4} + 2 i \, A a^{3} b + 5 i \, B a^{2} b^{2} - 3 i \, A a b^{3}\right )}\right )} \sqrt {b} {\rm weierstrassPInverse}\left (\frac {4 \, {\left (4 \, a^{2} - 3 \, b^{2}\right )}}{3 \, b^{2}}, -\frac {8 \, {\left (8 \, a^{3} - 9 \, a b^{2}\right )}}{27 \, b^{3}}, \frac {3 \, b \cos \left (d x + c\right ) + 3 i \, b \sin \left (d x + c\right ) + 2 \, a}{3 \, b}\right ) + {\left (\sqrt {2} {\left (4 i \, B a^{3} b - 2 i \, A a^{2} b^{2} - 5 i \, B a b^{3} + 3 i \, A b^{4}\right )} \cos \left (d x + c\right ) + \sqrt {2} {\left (4 i \, B a^{4} - 2 i \, A a^{3} b - 5 i \, B a^{2} b^{2} + 3 i \, A a b^{3}\right )}\right )} \sqrt {b} {\rm weierstrassPInverse}\left (\frac {4 \, {\left (4 \, a^{2} - 3 \, b^{2}\right )}}{3 \, b^{2}}, -\frac {8 \, {\left (8 \, a^{3} - 9 \, a b^{2}\right )}}{27 \, b^{3}}, \frac {3 \, b \cos \left (d x + c\right ) - 3 i \, b \sin \left (d x + c\right ) + 2 \, a}{3 \, b}\right ) - 3 \, {\left (\sqrt {2} {\left (2 i \, B a^{2} b^{2} - i \, A a b^{3} - i \, B b^{4}\right )} \cos \left (d x + c\right ) + \sqrt {2} {\left (2 i \, B a^{3} b - i \, A a^{2} b^{2} - i \, B a b^{3}\right )}\right )} \sqrt {b} {\rm weierstrassZeta}\left (\frac {4 \, {\left (4 \, a^{2} - 3 \, b^{2}\right )}}{3 \, b^{2}}, -\frac {8 \, {\left (8 \, a^{3} - 9 \, a b^{2}\right )}}{27 \, b^{3}}, {\rm weierstrassPInverse}\left (\frac {4 \, {\left (4 \, a^{2} - 3 \, b^{2}\right )}}{3 \, b^{2}}, -\frac {8 \, {\left (8 \, a^{3} - 9 \, a b^{2}\right )}}{27 \, b^{3}}, \frac {3 \, b \cos \left (d x + c\right ) + 3 i \, b \sin \left (d x + c\right ) + 2 \, a}{3 \, b}\right )\right ) - 3 \, {\left (\sqrt {2} {\left (-2 i \, B a^{2} b^{2} + i \, A a b^{3} + i \, B b^{4}\right )} \cos \left (d x + c\right ) + \sqrt {2} {\left (-2 i \, B a^{3} b + i \, A a^{2} b^{2} + i \, B a b^{3}\right )}\right )} \sqrt {b} {\rm weierstrassZeta}\left (\frac {4 \, {\left (4 \, a^{2} - 3 \, b^{2}\right )}}{3 \, b^{2}}, -\frac {8 \, {\left (8 \, a^{3} - 9 \, a b^{2}\right )}}{27 \, b^{3}}, {\rm weierstrassPInverse}\left (\frac {4 \, {\left (4 \, a^{2} - 3 \, b^{2}\right )}}{3 \, b^{2}}, -\frac {8 \, {\left (8 \, a^{3} - 9 \, a b^{2}\right )}}{27 \, b^{3}}, \frac {3 \, b \cos \left (d x + c\right ) - 3 i \, b \sin \left (d x + c\right ) + 2 \, a}{3 \, b}\right )\right )}{3 \, {\left ({\left (a^{2} b^{4} - b^{6}\right )} d \cos \left (d x + c\right ) + {\left (a^{3} b^{3} - a b^{5}\right )} d\right )}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F(-1)] Timed out
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Timed out} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {could not integrate} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [F]
time = 0.00, size = -1, normalized size = -0.00 \begin {gather*} \int \frac {\cos \left (c+d\,x\right )\,\left (A+B\,\cos \left (c+d\,x\right )\right )}{{\left (a+b\,\cos \left (c+d\,x\right )\right )}^{3/2}} \,d x \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________